home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
HardwareContext.h,v
< prev
next >
Wrap
Text File
|
1989-06-21
|
5KB
|
286 lines
head 3.3;
branch ;
access ;
symbols ;
locks grunwald:3.3; strict;
comment @ * @;
3.3
date 89.06.21.10.14.41; author grunwald; state Exp;
branches ;
next 3.2;
3.2
date 89.02.20.15.34.59; author grunwald; state Exp;
branches ;
next 3.1;
3.1
date 88.12.20.13.49.52; author grunwald; state Exp;
branches ;
next 1.3;
1.3
date 88.10.30.13.05.48; author grunwald; state Exp;
branches ;
next 1.2;
1.2
date 88.09.28.22.13.48; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 88.09.18.16.42.08; author grunwald; state Exp;
branches ;
next ;
desc
@@
3.3
log
@*** empty log message ***
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#ifndef HardwareContext_h
#define HardwareContext_h
#pragma once
#include <stream.h>
#include <assert.h>
#include <AwesimeConfig.h>
extern const long MagicStackMarker;
extern const void * UNINITIALIZED;
typedef enum {stackGrowsUp, stackGrowsDown} StackGrowthDirection;
extern StackGrowthDirection StackGrows;
typedef void (*voidFuncP)();
class CpuMultiplexor;
class SingleCpuMux;
class MultiCpuMux;
class SimulationMultiplexor;
class HardwareContext {
//
// The following four fields are machine dependent & their order
// should not be changed.
//
// If the stack grows down, stackBottom < stackTop.
//
void** saved_fp; // frame pointer
void** saved_sp; // stack pointer
void** stackBase; // bottom of stack
void** stackEnd; // maximum depth of stack? (actually, a MIN value)
unsigned stackMax; // maximum depth of stack? (actually, a MIN value)
unsigned stackSize; // stack size in units of void*
void **stackMallocAt;
long *stackCheck; // point to MagicStackMarker to check for corruption
unsigned checkStackLimits;
friend class Thread;
friend class CpuMultiplexor;
friend class SingleCpuMux;
friend class MultiCpuMux;
friend class SimulationMultiplexor;
//
// Accessed by friend classes only
//
void switchContext(HardwareContext *to);
void magicSwitchTo(HardwareContext *to);
void **getSp();
void **mallocAt();
void buildReturnFrame(void * returnThis, voidFuncP returnAddress);
void stackOverflow();
//
// never allocated by anything other than friend classes
//
HardwareContext(int checked, unsigned stackSize);
public:
HardwareContext();
long maxStackDepth();
void checkStack(int overage = 0);
void classPrintOn(ostream& strm);
};
inline
HardwareContext::HardwareContext()
{
int NotReached = 0;
assert( NotReached );
}
inline void **
HardwareContext::mallocAt()
{
return( stackMallocAt );
}
inline ostream&
operator<<(ostream& strm, const HardwareContext& ob)
{
ob.classPrintOn(strm);
return strm;
}
inline long
HardwareContext::maxStackDepth()
{
return( long(stackMax) );
}
#ifdef __GNUG__
//
// Gnu G++ allows inline asm's
//
inline void **
HardwareContext::getSp()
{
void **foo;
#if defined(UMAX)
asm volatile ("sprd sp,%0" : "=g" (foo));
#elif defined(SUN)
asm volatile ("movel sp,%0" : "=g" (foo));
#else
must define machine type
#endif
return( foo );
}
#endif
inline void
HardwareContext::checkStack(int overage)
{
unsigned depth = stackBase - getSp() + overage;
if (stackMax < depth) {
stackMax = depth;
}
if ( stackMax >= stackSize || *stackCheck != MagicStackMarker ) {
stackOverflow();
}
}
#endif HardwareContext_h
@
3.2
log
@Start using Gnu library heaps for schedulers
@
text
@d9 1
d11 3
a13 1
#include "stream.h"
d23 3
a25 1
class HardwareContext;
d29 6
a34 6
//
// The following four fields are machine dependent & their order
// should not be changed.
//
// If the stack grows down, stackBottom < stackTop.
//
d44 1
a44 1
d47 2
d50 1
a50 1
d57 1
a57 1
d61 1
a61 1
d66 1
a66 1
d68 2
a69 1
d75 7
d95 1
a95 1
d101 19
@
3.1
log
@Steay version
@
text
@@
1.3
log
@*** empty log message ***
@
text
@d12 1
d14 1
d37 1
a37 1
long *stackCheck;
d52 2
d55 3
a57 1
public:
d60 2
a61 1
void buildReturnFrame(void * returnThis, voidFuncP returnAddress);
d63 1
d86 13
@
1.2
log
@*** empty log message ***
@
text
@d1 6
d19 1
d39 2
a40 1
friend class HardwareCpu;
d48 3
a52 1
~HardwareContext();
d59 5
@
1.1
log
@Initial revision
@
text
@d28 1
@